import re, os


def r(p):
    f = open(p)
    c = f.read()
    f.close()
    return c


def w(p, s):
    f = open(p, 'w')
    f.write(s)
    f.close()


d = {'java': r'/\*\*[\w\W]+?\*/', 'xml': r'<!--[\w\W]+?-->'}


def clean(lang, p):
    s = r(p)
    s = re.sub(d[lang], '', s)
    w(p, s)


for root, dirs, files in os.walk('e:/m'):
    for f in files:
        p = os.path.join(root, f)
        if p.endswith('.java'):
            clean('java', p)
        elif p.endswith('.xml'):
            clean('xml', p)
